<template>
  <a-card :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="inline"  @keyup.enter.native="searchQuery">
        <a-row :gutter="12">
          <a-col :md="7" :sm="8">
            <a-form-item label="" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 0}">
              <a-select
                ref="select"
                v-model="queryParam.brandId"
                placeholder="品牌"
              >
                <a-select-option :value="item.id" v-for="(item, index) in brandOption" :key="index">{{item.brandName}}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="7" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>

      <div class="table-operator" style="border-top: 5px">
        <a-button type="primary" @click="handleAdd">新增</a-button>
      </div>

      <a-table
        ref="table"
        rowKey="id"
        size="middle"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
        <span slot="status" slot-scope="text, record">
          <a-switch :checked="record.status == 0" @click="handleSwitch(record,$event ? ischoose : noChoose)"></a-switch>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">
            <a-icon type="edit"/>
            编辑
          </a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>

    <slogan-Modal ref="modalForm" @ok="modalFormOk"></slogan-Modal>
  </a-card>
</template>

<script>
import { filterObj } from '@/utils/util';
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import sloganModal from './modules/sloganModal'
import { brandList } from '@/api/marketingCenter/newmember.js'

export default {
  name:'',
  mixins:[JeecgListMixin],
  components: {
    sloganModal
  },
  data() {
    return {
      removeVisible: false,
      qrCode:'',
      queryParam:{
        current: 1,
        size: 10,
      },
      // 表头
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 120,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '内容',
          align: "center",
          dataIndex: 'pp',
        },
        {
          title: '品牌',
          align: "center",
          dataIndex: 'bz',
        },
        {
          title: '排序',
          align: "center",
          dataIndex: 'px',
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          scopedSlots: { customRender: 'status' }
        },
        {
          title: '操作',
          align: "center",
          dataIndex: 'action',
          scopedSlots: {customRender: 'action'},
        }
      ],
      url: {
      //   list: "/backend/coffee/pageStoreVo",
      //   delete: "/backend/coffee/delStoreById",
      },
      brandOption:[],
    }
  },
  created() {
    this.getbrandList()
  },
  methods: {
    getQueryParams() {
      // var param = Object.assign({}, this.queryParam);
      // param.current = this.ipagination.current;
      // param.pageSize = this.ipagination.pageSize;
      // return filterObj(param);
    },
    getbrandList() {
      brandList().then(res => {
        if (res.code == 200) {
          this.brandOption = res.data
        }
      })
    },
  }
}
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>